package org.fjala.softure.tree;

/**
 * Abstract implementation for a {@link Node}.
 * 
 * @author Dann Meneses
 * 
 * @param <T> Type of elements in this tree.
 */
public abstract class AbstractNode<T> implements Node<T> {

    /**
     * Data of the node.
     */
    protected T data;
    
    /**
     * Parent of this node.
     */
    protected Node<T> parent;

    /**
     * Costructor that set the data and the parent for this node.
     * 
     * @param data data of the node
     * @param parent parent of the node
     */
    public AbstractNode(T data, Node<T> parent) {
        this.data = data;
        this.parent = parent;
    }

    @Override
    public T getData() {
        return data;
    }
    
    @Override
    public void setData(T data) {
        this.data = data;
    }

    @Override
    public Node<T> getParent() {
        return parent;
    }
    
    @Override
    public void setParent(Node<T> parent) {
        this.parent = parent;
    }
}
